/*
 * @Author: Turump 
 * @Date: 2021-05-11 15:17:31 
 * @Last Modified by: Turump
 * @Last Modified time: 2021-05-11 16:42:36
 */

import ActionBaseTask from "./ActionBaseTask";

const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu("动作任务/ContentSize")
export default class ContentSizeTask extends ActionBaseTask {

    @property({ displayName: "ContentSize" })
    contentSize: cc.Size = cc.size(0, 0)

    onLoad() {
        if(CC_EDITOR) {
            this.contentSize = this.node.getContentSize();
        }
    }

    getAction() {
        return cc.tween(this.node)
            .parallel(
                this.getPlayAudioTween(),
                cc.tween(this.node).to(this.actionDuration, { width: this.contentSize.width, height: this.contentSize.height }))
    }
}
